package cn.iocoder.yudao.module.mzt.dal.mysql.articleinteraction;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mzt.dal.dataobject.articleinteraction.ArticleInteractionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mzt.controller.admin.articleinteraction.vo.*;

/**
 * 文章交互记录 Mapper
 *
 * @author Geordie
 */
@Mapper
public interface ArticleInteractionMapper extends BaseMapperX<ArticleInteractionDO> {

    default PageResult<ArticleInteractionDO> selectPage(ArticleInteractionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ArticleInteractionDO>()
                .likeIfPresent(ArticleInteractionDO::getArticleTitle, reqVO.getArticleTitle())
                .likeIfPresent(ArticleInteractionDO::getCategoryName, reqVO.getCategoryName())
                .eqIfPresent(ArticleInteractionDO::getType, reqVO.getType())
                .eqIfPresent(ArticleInteractionDO::getUserAgent, reqVO.getUserAgent())
                .betweenIfPresent(ArticleInteractionDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ArticleInteractionDO::getId));
    }

}